without in-built methods find the min and max number in an array